package com.zkny.zknyerp.controller;

import com.zkny.zknyerp.model.Model;
import com.zkny.zknyerp.service.ModelService;
import com.zkny.zknyerp.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * 用户对外接口
 */
@RestController
@RequestMapping("/api/model")
@CrossOrigin
public class ModelController {

    @Autowired
    private ModelService modelService;

    @GetMapping("/addModel")
    public Result addModel(@RequestParam(value = "model") String model){
        return modelService.addModel(model);
    }

    @GetMapping("/selectModel")
    public Result selectModel(Integer page,Integer limit){
        return  modelService.selectModel(page,limit);
    }

    @PostMapping("/updateModel")
    public Result updateModel(@RequestBody Model model){
        return modelService.updateModel(model);
    }

    @DeleteMapping("/deleteModel")
    public Result deleteModel(@RequestBody Model model){
        return modelService.deleteModel(model);
    }

    @GetMapping("/getId")
    public Result getId(Integer id){
        return modelService.getId(id);
    }

    @GetMapping("/getModel")
    public Result getModel(){
        return modelService.getModel();
    }

}
